{extend name='template/base'}{/extend}
{block name='title'}{/block}
{block name='style'}{/block}
{block name='script'}{/block}
{block name='footer'}{/block}
{block name='content'}
<header class="header">
    <div>
        <a class="back"  href="{:url('shop/Shop/index')}"><i class="iconfont icon-zuoyoujiantou-copy-copy-copy"></i></a>
        {$shop.name}
        <a id="#popover" style="line-height: 45px;" class="menu mui-action-menu mui-icon mui-icon-bars mui-pull-right"
           href="#popover"></a>

    </div>

</header>
<div id="popover" class="mui-popover" style="width: 100px;top: 0!important;position: absolute;">
    <ul class="mui-table-view">
        <!--<li class="mui-table-view-cell"><a href="#">店铺详情</a></li>-->
        <li v-if="(is_collect==0)" class="mui-table-view-cell"><a @tap="collect({$store_id})">收藏店铺</a></li>
        <li v-else class="mui-table-view-cell"><a @tap="del_collect({$store_id})">取消收藏</a></li>
    </ul>
</div>
<div class="pages">
    <div id="buy_page">
        <div class="buy-page">
            <div class="shop-list head">
                <ul>
                    <li>
                        <div class="img"><img src="{$shop.logo}"/></div>
                        <div class="text">
                            <div class="title">{$shop.name}</div>
                            <div>
                                <p class="ellipsis font12">{$shop.shop_address}</p>
                                <p class="font12">
                                    <span>￥{$shop.aps_price}元</span>起送
                                    {if condition='$distance !=""' }
                                    <span class="pull-right">{$distance}km</span>
                                    {/if}
                                </p>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <nav>
                <ul>
                    <li>
                        <a href={:url("shop/Goods/index",['store_id'=>$store_id])}>全部</a>
                    </li>
                    <!--<li class="active">-->
                    <!--<a href="">热门</a>-->
                    <!--</li>-->
                    {volist name="c_list" id="c_vo"}
                    <li {if condition='$category eq $c_vo.id' } class="active" {/if} >
                    <a href={:url("shop/Goods/index",['category'=>$c_vo.id,'store_id'=>$store_id])}>{if condition='$c_vo.isdefault eq 1' } 其他 {else /}{$c_vo.name} {/if}</a>
                    </li>
                    {/volist}

                    <!--<li>-->
                    <!--<a href="">东北菜</a>-->
                    <!--</li>-->
                    <!--<li>-->
                    <!--<a href="">热门</a>-->
                    <!--</li>-->
                    <!--<li>-->
                    <!--<a href="">小吃快餐</a>-->
                    <!--</li>-->
                    <!--<li>-->
                    <!--<a href="">川菜</a>-->
                    <!--</li>-->
                    <!--<li>-->
                    <!--<a href="">东北菜</a>-->
                    <!--</li>-->
                </ul>
            </nav>
            <div class="goods-list">
                <ul>
                    {volist name="list" id="vo"}
                    <li @tap="detail({$vo.id})">
                        <div class="img"><img src="{$vo.cover_image}"/></div>
                        <div class="text">
                            <div class="title">{$vo.name}</div>
                            <div>
                                <div class="l">
                                    <!--<p class="ellipsis font12">月售 90</p>-->
                                    <p class="font12">
                                        <span>￥{$vo.price}元</span>
                                    </p>
                                </div>

                                <div class="r">
                                    {if condition="($shop.is_work==1)"}
                                    <span @tap.stop="down_tap({$vo.v_price},{$vo.id},{$vo.v_flag})" {if condition='$vo.quantity>0' } style="display: inline;" {/if} class="down"><i class="iconfont icon-wuuiconsuoxiao"></i></span>
                                    <input type="tel" readonly {if condition='$vo.quantity>0' } style="display: inline;" {/if} class="num" value="{$vo.quantity}" maxlength="3">
                                    <span @tap.stop="up_tap({$vo.price},{$vo.id},{$vo.v_flag},'{$vo.name}')" class="up"> <i class="iconfont icon-wuuiconxiangjifangda"></i></span>
                                    {else /}
                                    <span  class="down" style="display: block;"> <i class="iconfont icon-wuuiconxiangjifangda"></i></span>
                                    {/if}
                                </div>
                            </div>
                        </div>
                    </li>
                    {/volist}
                </ul>
            </div>
            {if condition="($shop.is_work==1)"}
            <div  class="foot-btn">
                <div>
                    <a href="{:url('/cart/Cart/index')}"> <i class="iconfont icon-gouwuche"></i></a>
                    <span id="total_price">{$total_price}元</span>
                    <a @tap="send_btn()" id="send_btn" class="btn">去结算</a>
                </div>
            </div>
            {else /}
            <div  class="foot-btn color-gray">
                <div class="text-center" style="color: white;background-color: grey">
                   商家休息，停止接单
                </div>
            </div>
            {/if}
        </div>
    </div>

    <div class="popups-module">
        <div class="popups-module-wrap" id="popups">
            <div class="popups-module-box">
                <!--<a class="btn">关闭</a>-->
                <div class="specification">
                    <div class="title">{{v_goods_name}}</div>
                    <p>规格</p>
                    <ul class="box">
                        <template v-for="(item, index) in v_items">
                            <li v-bind:class="[index==a_index? 'active' : '']" @tap="variant(item.id,item.price,index)">
                                {{item.name}}
                            </li>
                        </template>
                    </ul>
                </div>
            </div>
            <div class="popups-module-footer">
                <div class="specification">
                    <div class="price">
                        <span>￥{{v_price}}</span>
                        <a @tap="save_variant()" class="btn">确定</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}
{block name='script_extra'}
<script>
    var list_url = "{:url('shop/Goods/index')}";
    var detail_url = "{:url('shop/Goods/detail')}";
    var send_order_url = "{:url('order/Order/send_order')}";
    var cart_url = "{:url('cart/Cart/have_cart')}";
    var add_cart_url = "{:url('cart/Cart/add_cart')}";
    var variant_url = "{:url('shop/Goods/get_variant')}";
    var collect_url = "{:url('shop/Shop/collect_store')}";
    var del_collect_url = "{:url('shop/Shop/del_collect_store')}";
    var store_id = "{$store_id}";
    var total_price = "{$total_price}";
    var is_collect = "{$is_collect}";
    total_price = parseInt(total_price);
    require(['goods/index']);
</script>
{/block}